<template>
  <div class="page_search">
	<div class="warp">
	  <div class="container">
		<div class="row">
		  <div class="col-12">
			<div class="card_result_search">
			  <div class="title">搜索结果</div>

				<!-- 文章搜索结果 -->
			  <list_result_search
				:list="result_article"
				title="招聘资讯"
				source_table="article"
			  ></list_result_search>

				<!-- 论坛搜索结果 -->
			  <list_result_search
				:list="result_forum"
				title="交流论坛"
				source_table="forum"
			  ></list_result_search>

						  <list_result_search
				v-if="$check_action('/registered_users/list', 'get')"
				:list="result_registered_users_gender"
				title="注册用户性别"
				source_table="registered_users"
			  ></list_result_search>
															  <list_result_search
				v-if="$check_action('/position_classification/list', 'get')"
				:list="result_position_classification_position_category"
				title="职位分类职位类别"
				source_table="position_classification"
			  ></list_result_search>
												  <list_result_search
				v-if="$check_action('/merchant_users/list', 'get')"
				:list="result_merchant_users_merchant_name"
				title="商家用户商家名称"
				source_table="merchant_users"
			  ></list_result_search>
												  <list_result_search
				v-if="$check_action('/recruiting_part_time_jobs/list', 'get')"
				:list="result_recruiting_part_time_jobs_merchant_name"
				title="招聘兼职商家名称"
				source_table="recruiting_part_time_jobs"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/recruiting_part_time_jobs/list', 'get')"
				:list="result_recruiting_part_time_jobs_position_name"
				title="招聘兼职职位名称"
				source_table="recruiting_part_time_jobs"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/recruiting_part_time_jobs/list', 'get')"
				:list="result_recruiting_part_time_jobs_position_category"
				title="招聘兼职职位类别"
				source_table="recruiting_part_time_jobs"
			  ></list_result_search>
																																	  <list_result_search
				v-if="$check_action('/part_time_application/list', 'get')"
				:list="result_part_time_application_merchant_name"
				title="兼职申请商家名称"
				source_table="part_time_application"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/part_time_application/list', 'get')"
				:list="result_part_time_application_position_name"
				title="兼职申请职位名称"
				source_table="part_time_application"
			  ></list_result_search>
																																				  <list_result_search
				v-if="$check_action('/communication_inquiry/list', 'get')"
				:list="result_communication_inquiry_merchant_name"
				title="交流询问商家名称"
				source_table="communication_inquiry"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/communication_inquiry/list', 'get')"
				:list="result_communication_inquiry_position_name"
				title="交流询问职位名称"
				source_table="communication_inquiry"
			  ></list_result_search>
											  <list_result_search
				v-if="$check_action('/communication_inquiry/list', 'get')"
				:list="result_communication_inquiry_full_name"
				title="交流询问姓名"
				source_table="communication_inquiry"
			  ></list_result_search>
												</div>
		  </div>
		</div>
	  </div>
	</div>
  </div>
</template>

<script>
import mixin from "../../mixins/page.js";
import list_result_search from "../../components/diy/list_result_search.vue";

export default {
  mixins: [mixin],
  data() {
	return {
	  "query": {
		word: "",
	  },
	  "result_article": [],
	  "result_forum": [],
						"result_registered_users_gender":[],
															"result_position_classification_position_category":[],
												"result_merchant_users_merchant_name":[],
												"result_recruiting_part_time_jobs_merchant_name":[],
								"result_recruiting_part_time_jobs_position_name":[],
								"result_recruiting_part_time_jobs_position_category":[],
																																	"result_part_time_application_merchant_name":[],
								"result_part_time_application_position_name":[],
																																				"result_communication_inquiry_merchant_name":[],
								"result_communication_inquiry_position_name":[],
											"result_communication_inquiry_full_name":[],
										};
  },
  methods: {
	/**
	 * 获取文章
	 */
	get_article() {
	  this.$get("~/api/article/get_list?like=0", { page: 1, size: 10, title: this.query.word }, (json) => {
		if (json.result) {
		  this.result_article = json.result.list;
		}
	  });
	},
	/**
	 * 获取交流论坛
	 */
	get_forum() {
	  this.$get("~/api/forum/get_list?like=0", { page: 1, size: 10, title: this.query.word }, (json) => {
		if (json.result) {
		  this.result_forum = json.result.list;
		}
	  });
	},

				/**
	 * 获取gender
	 */
	get_registered_users_gender(){
		this.$get("~/api/registered_users/get_list?like=0", { page: 1, size: 10, "gender": this.query.word }, (json) => {
		  if (json.result) {
			var result_registered_users_gender = json.result.list;
			result_registered_users_gender.map(o => o.title = o['gender'])
	  			this.result_registered_users_gender = result_registered_users_gender
		 	}
		});
	},
													/**
	 * 获取position_category
	 */
	get_position_classification_position_category(){
		this.$get("~/api/position_classification/get_list?like=0", { page: 1, size: 10, "position_category": this.query.word }, (json) => {
		  if (json.result) {
			var result_position_classification_position_category = json.result.list;
			result_position_classification_position_category.map(o => o.title = o['position_category'])
	  			this.result_position_classification_position_category = result_position_classification_position_category
		 	}
		});
	},
										/**
	 * 获取merchant_name
	 */
	get_merchant_users_merchant_name(){
		this.$get("~/api/merchant_users/get_list?like=0", { page: 1, size: 10, "merchant_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_merchant_users_merchant_name = json.result.list;
			result_merchant_users_merchant_name.map(o => o.title = o['merchant_name'])
	  			this.result_merchant_users_merchant_name = result_merchant_users_merchant_name
		 	}
		});
	},
										/**
	 * 获取merchant_name
	 */
	get_recruiting_part_time_jobs_merchant_name(){
		this.$get("~/api/recruiting_part_time_jobs/get_list?like=0", { page: 1, size: 10, "merchant_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_recruiting_part_time_jobs_merchant_name = json.result.list;
			result_recruiting_part_time_jobs_merchant_name.map(o => o.title = o['merchant_name'])
	  			this.result_recruiting_part_time_jobs_merchant_name = result_recruiting_part_time_jobs_merchant_name
		 	}
		});
	},
						/**
	 * 获取position_name
	 */
	get_recruiting_part_time_jobs_position_name(){
		this.$get("~/api/recruiting_part_time_jobs/get_list?like=0", { page: 1, size: 10, "position_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_recruiting_part_time_jobs_position_name = json.result.list;
			result_recruiting_part_time_jobs_position_name.map(o => o.title = o['position_name'])
	  			this.result_recruiting_part_time_jobs_position_name = result_recruiting_part_time_jobs_position_name
		 	}
		});
	},
						/**
	 * 获取position_category
	 */
	get_recruiting_part_time_jobs_position_category(){
		this.$get("~/api/recruiting_part_time_jobs/get_list?like=0", { page: 1, size: 10, "position_category": this.query.word }, (json) => {
		  if (json.result) {
			var result_recruiting_part_time_jobs_position_category = json.result.list;
			result_recruiting_part_time_jobs_position_category.map(o => o.title = o['position_category'])
	  			this.result_recruiting_part_time_jobs_position_category = result_recruiting_part_time_jobs_position_category
		 	}
		});
	},
																															/**
	 * 获取merchant_name
	 */
	get_part_time_application_merchant_name(){
		this.$get("~/api/part_time_application/get_list?like=0", { page: 1, size: 10, "merchant_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_part_time_application_merchant_name = json.result.list;
			result_part_time_application_merchant_name.map(o => o.title = o['merchant_name'])
	  			this.result_part_time_application_merchant_name = result_part_time_application_merchant_name
		 	}
		});
	},
						/**
	 * 获取position_name
	 */
	get_part_time_application_position_name(){
		this.$get("~/api/part_time_application/get_list?like=0", { page: 1, size: 10, "position_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_part_time_application_position_name = json.result.list;
			result_part_time_application_position_name.map(o => o.title = o['position_name'])
	  			this.result_part_time_application_position_name = result_part_time_application_position_name
		 	}
		});
	},
																																		/**
	 * 获取merchant_name
	 */
	get_communication_inquiry_merchant_name(){
		this.$get("~/api/communication_inquiry/get_list?like=0", { page: 1, size: 10, "merchant_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_communication_inquiry_merchant_name = json.result.list;
			result_communication_inquiry_merchant_name.map(o => o.title = o['merchant_name'])
	  			this.result_communication_inquiry_merchant_name = result_communication_inquiry_merchant_name
		 	}
		});
	},
						/**
	 * 获取position_name
	 */
	get_communication_inquiry_position_name(){
		this.$get("~/api/communication_inquiry/get_list?like=0", { page: 1, size: 10, "position_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_communication_inquiry_position_name = json.result.list;
			result_communication_inquiry_position_name.map(o => o.title = o['position_name'])
	  			this.result_communication_inquiry_position_name = result_communication_inquiry_position_name
		 	}
		});
	},
									/**
	 * 获取full_name
	 */
	get_communication_inquiry_full_name(){
		this.$get("~/api/communication_inquiry/get_list?like=0", { page: 1, size: 10, "full_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_communication_inquiry_full_name = json.result.list;
			result_communication_inquiry_full_name.map(o => o.title = o['full_name'])
	  			this.result_communication_inquiry_full_name = result_communication_inquiry_full_name
		 	}
		});
	},
									
  },
  components: { list_result_search },
	created(){
    this.query.word = this.$route.query.word || "";
  },
  mounted() {
	this.get_article();
	this.get_forum();
					this.get_registered_users_gender();
														this.get_position_classification_position_category();
											this.get_merchant_users_merchant_name();
											this.get_recruiting_part_time_jobs_merchant_name();
							this.get_recruiting_part_time_jobs_position_name();
							this.get_recruiting_part_time_jobs_position_category();
																																this.get_part_time_application_merchant_name();
							this.get_part_time_application_position_name();
																																			this.get_communication_inquiry_merchant_name();
							this.get_communication_inquiry_position_name();
										this.get_communication_inquiry_full_name();
									  },
  watch: {
	$route() {
	  $.push(this.query, this.$route.query);
	  this.get_article();
	  this.get_forum();
				  this.get_registered_users_gender();
													  this.get_position_classification_position_category();
										  this.get_merchant_users_merchant_name();
										  this.get_recruiting_part_time_jobs_merchant_name();
						  this.get_recruiting_part_time_jobs_position_name();
						  this.get_recruiting_part_time_jobs_position_category();
																															  this.get_part_time_application_merchant_name();
						  this.get_part_time_application_position_name();
																																		  this.get_communication_inquiry_merchant_name();
						  this.get_communication_inquiry_position_name();
									  this.get_communication_inquiry_full_name();
										},
  },
};
</script>

<style scoped>
.card_search {
  text-align: center;
}
.card_result_search>.title {
  text-align: center;
  padding: 10px 0;
}
</style>
